<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/Home.css" />
<?php
    $conn = mysql_connect("localhost", "root","123456") or die("Ket noi den MySQL that bai");
    mysql_select_db("mp3", $conn);
    mysql_query("SET NAMES UTF8",$conn);
    $id=$_REQUEST["id"];
    $sql="select * from `nghesi` where `id_nghesi`= ".$id;
                $q = mysql_query($sql);
                while ($row = mysql_fetch_array($q))
                {
                    $id=$row["id_nghesi"];
                    $tennghesi=$row["nghedanh"];
                    $tenthat=$row["tenthat"];
                    $ngaysinh=$row["ngaysinh"];
                    $quoctich=$row["quoctich"];
                    $tieusu=$row["tieusu"];
                     $pic2=$row["pic2"];
                    $pic1=$row["pic1"];
?>
<title><?=$tennghesi?></title>
<link rel="stylesheet" type="text/css" href="engine1/style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta name="keywords" content="WOW Slider, Wordpress Gallery Slider, Wordpress Photo Slider" />
<meta name="description" content="WOWSlider created with WOW Slider, a free wizard program that helps you easily generate beautiful web slideshow" />
<script language="javascript" type="text/javascript" src="engine1/jquery.js"></script>

</head>
<?php include_once('master_menu.php');?>

<div class="pageartist">
<h1><?=$tennghesi?></h1>
<div class="singerbig">
<img style="padding-bottom:10px" src="<?=$pic2?>" width="1080px" height="215px" />
<div class="menuvideo">
      <ul class="menu2">        
        <li> <a href="artist_page.php?id=<?=$id?>">TẤT CẢ</a> </li>        
        <li > <a href="artist_page_tieusu.php?id=<?=$id?>">TIỂU SỬ</a> </li>
        <li class="select"> <span>BÀI HÁT</span> </li>
        <li> <a href="artist_page_album.php?id=<?=$id?>">ALBUM</a> </li>
        <li> <a href="artist_page_video.php?id=<?=$id?>">VIDEO</a> </li>
      </ul>
    </div>
</div>
<div class="contsinger">
	<div class="contsinger">
	<div class="song-list">
    <h2>Bài Hát</h2>
    <span>
    &nbsp; /
    <a href="#">tất cả</a></span>
 
       <ul>
    
    
     <?php
     if (!isset($_GET['page'])) 
     {
        $_GET['page'] = 1;
     }
    $vitri = ($_GET["page"] - 1 ) * 5 ;    
    $sql= mysql_query("select * from `music_nghesi`
                inner join `nghesi` on `nghesi`.`id_nghesi`=`music_nghesi`.`id_nghesi` 
                inner join `music` on `music`.`id_music` = `music_nghesi`.`id_music`
                where `music_nghesi`.`id_nghesi`= ".$id. " limit ".$vitri.",5");
    $itemcount=1; 
   while ($row = mysql_fetch_array($sql)) 
   { 
        $baihat=$row["id_music"];
        $id=$row["id_nghesi"];
        $tenbh=$row["tenmusic"];
?>    

    <li>
    	<div>
        <span><?=$itemcount?></span>
      	<h3><a href="chitietbh.php?id=<?=$baihat?>&idcs=<?=$id?>"> &emsp;  &emsp; <?=$tenbh?></a></h3>
        
        </div>
        <div class="icon-artist">
        <a href="#">
        <img width="24" height="24" src="images/round_down_arrow.png" />
        </a>
        <a href="#">
        <img width="24" height="24" src="images/round_add.png" />
        </a>
        </div>
    </li>

   <?php
    $itemcount++;
  }


                $re = mysql_query("select * from `music_nghesi` 
                inner join `nghesi` on `nghesi`.`id_nghesi`=`music_nghesi`.`id_nghesi` 
                inner join `music` on `music`.`id_music` = `music_nghesi`.`id_music`
                where `music_nghesi`.`id_nghesi`= ".$id);
    $n = mysql_num_rows($re);
    
    $tong_so_trang = floor($n/5);
    echo"<ul style='  margin:0;text-align:center'>";
   
    if ($_GET['page'] > 1) 
    { 
        echo"<li class='ptrang2'>";
        echo '<a href=artist_page_baihat.php?page='.($_GET['page']-1).'&id='.$id.'>&emsp;<&emsp;</a>';
        echo"</li>";
    }
     $begin=$_GET['page']-3;
    if ($begin < 1)
    {
        $begin=1;
    }
    $end=$_GET['page']+3;
    if ($end > $tong_so_trang)
    {
        $end = $tong_so_trang;
    }
   
     for ($i=$begin ; $i<=$end ; $i++) 
      {
        
       if ($i == $_GET["page"]) 
       {
        echo"<li class='ptrang'>";
       echo $i;
       echo"</li>";
       }
        
       else
     {
             echo"<li class='ptrang2'>";
            echo '<a style=border:1px solid white ; href=artist_page_baihat.php?page='.$i.'&id='.$id.'>&emsp;'.$i.'&emsp;</a>';
              echo"</li>";
     }
     }
        
      
      if ($_GET['page'] < $tong_so_trang) 
    { 
         echo"<li class='ptrang2'>";
        echo '<a href=artist_page_baihat.php?page='.($_GET['page']+1).'&id='.$id.'>&emsp;>&emsp;</a>';
        echo"</li>";
    }  
   
     echo"</ul>";
    mysql_close($conn);
?> 
        </ul>
    </div>
</div>
    
</div>
<div class="inforsinger">

<div class="singersmall"><img src="<?=$pic1?>" width="270" height="270" /></div>
<div class="inforsinger">
<p>
    	<span>Tên thật: </span>
        <?=$tenthat?>
    </p>
    <p>
    	<span>Ngày sinh: </span>
        <?=$ngaysinh?>
    </p>
    <p>
    	<span>Quốc Gia: </span>
       <?=$quoctich?>
    </p>
    <p>
    	<span><a href="artist_page_tieusu.php?id=<?=$id?>">Xem toàn bộ</a></span>
    </p>
</div>
</div>
</div>
  <?php 
   } 
   ?> 
<?php include_once('master_footer.php');?>